package com.bs.auth.controller;

import com.bs.common.utils.Result;
import com.bs.common.vo.LoginUserVo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static com.bs.auth.interceptor.AuthRestInterceptor.loginUserThreadLocal;

/**
 * @author bingshao
 * @date 2022/9/21
 **/
@RestController
@RequestMapping("/test")
public class TestController {

    @GetMapping("/test")
    public void test() {
        LoginUserVo loginUserVo = loginUserThreadLocal.get();
        System.out.println(loginUserVo.getUsername());
    }

    @GetMapping("/testA")
    public Result<Integer> testA() {
        int i = 10 / 0;
        return Result.success(i);
    }
}
